//
//  MCBaseLotteryHallViewController.m
//  TLYL
//
//  Created by miaocai on 2017/6/7.
//  Copyright © 2017年 TLYL01. All rights reserved.
//

#import "MCBaseLotteryHallViewController.h"
#import "MCPullMenuViewController.h"
#import "MCPullMenuPresentationController.h"
#import "MCAlertView.h"
#import "MCPickBottomButton.h"
#import "UIImage+Extension.h"
#import "MCMoneyPopView.h"
#import "MCMSPopView.h"

@interface MCBaseLotteryHallViewController ()<MCPullMenuDelegate>

#pragma mark - property
/**定时器*/
@property(nonatomic,strong) NSTimer *timer;
// 时间
@property (nonatomic,weak) UILabel *timerDetailLabel;
// 期数
@property (nonatomic,weak) UILabel *timerLabel;
/**弹出视图*/
@property (nonatomic,weak) MCAlertView *alertView;
/**底部视图*/
@property (nonatomic,weak) UIView *bottomView;
/**下拉按钮*/
@property (nonatomic,weak) UIButton *btnPCatergy;
/**倒计时按钮*/
@property (nonatomic,weak) UIButton *btnHistroy;
/**万千百选项卡*/
@property (nonatomic,weak) UIView *selectedCardView;
/**万千百选项卡Array*/
@property (nonatomic,strong) NSMutableArray *selectedCardArray;

@property (nonatomic,strong) NSString *dateString;

@property (nonatomic,strong) NSString *lastString;

@property (nonatomic,assign) int time;


@property (nonatomic,assign) BOOL randomBtnSelected;

@property (nonatomic,weak) UIButton *randomBtn;


@end

@implementation MCBaseLotteryHallViewController



#pragma mark - life cycle
- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self setUpUI];
    //为导航栏添加右侧按钮(更多)
    [self addNavRightBtn];
    //底部按钮
    [self setUpBottomView];

    [self setUpTopSelectedCardView];
    
    [self selectLotteryKindWithTag:[MCPullMenuViewController Get_DefaultDicWithID:self.lotteriesTypeModel.categoryID]];

    
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [[NSNotificationCenter defaultCenter] removeObserver:self];
    [self stopTimer];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self registerNotifacation];
    [self setUpTimer];
}
- (void)dealloc{
    NSLog(@"MCBaseLotteryHallViewController---------dealloc");
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
#pragma mark - SetUpUI
- (void)addNavRightBtn {
    UIButton *btn = [[UIButton alloc] init];
    [btn setImage:[UIImage imageNamed:@"timg.jpeg"] forState:UIControlStateNormal];
    btn.frame = CGRectMake(0, 0, MC_REALVALUE(44), MC_REALVALUE(44));
    [btn addTarget:self action:@selector(moreBtnClick:) forControlEvents:UIControlEventTouchDown];
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
    self.navigationItem.rightBarButtonItem = rightItem;
    
    
    UIButton *btnPCatergy = [[UIButton alloc] init];
    [self.view addSubview:btnPCatergy];
    btnPCatergy.backgroundColor = MC_ColorWithAlpha(54, 128, 211, 1);
    [btnPCatergy setImage:[UIImage imageNamed:@"更多"] forState:UIControlStateNormal];
    btnPCatergy.frame = CGRectMake(0, MC_REALVALUE(64), G_SCREENWIDTH, MC_REALVALUE(36));
    [btnPCatergy setTitle:@"下拉按钮" forState:UIControlStateNormal];
    btnPCatergy.titleLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(14)];
    btnPCatergy.titleLabel.textAlignment = NSTextAlignmentCenter;
    btnPCatergy.contentEdgeInsets = UIEdgeInsetsMake(MC_REALVALUE(11), 0, 0, 0);
    [btnPCatergy addTarget:self action:@selector(btnPCatergyClick:) forControlEvents:UIControlEventTouchUpInside];
    self.btnPCatergy = btnPCatergy;
    
    UIButton *btnHistroy = [[UIButton alloc] init];
    [self.view addSubview:btnHistroy];
    btnHistroy.backgroundColor = RGB(250, 250, 250);
    btnHistroy.frame = CGRectMake(0, MC_REALVALUE(100), G_SCREENWIDTH, MC_REALVALUE(30));
    [btnHistroy addTarget:self action:@selector(btnHistroyClick:) forControlEvents:UIControlEventTouchUpInside];
    self.btnHistroy = btnHistroy;
    
    UILabel *timerLabel = [[UILabel alloc] init];
    timerLabel.text = @"距离024期截止:";
    self.timerLabel = timerLabel;
    [btnHistroy addSubview:timerLabel];
    timerLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(13)];
    
    
    UILabel *timerDetailLabel = [[UILabel alloc] init];
    timerDetailLabel.backgroundColor=RGB(37, 133, 207);
    timerDetailLabel.text = @" 00:00:03 ";
    timerDetailLabel.layer.cornerRadius=3.0;
    timerDetailLabel.clipsToBounds=YES;
    timerDetailLabel.textColor=[UIColor whiteColor];
    self.timerDetailLabel = timerDetailLabel;
    [btnHistroy addSubview:timerDetailLabel];
    timerDetailLabel.font = [UIFont boldSystemFontOfSize:MC_REALVALUE(13)];
    
    
    UILabel *bonusLabel = [[UILabel alloc] init];
    bonusLabel.text = @"玩法奖金：";
    [btnHistroy addSubview:bonusLabel];
    bonusLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(13)];
    
    
    UILabel *bonusDetailLabel = [[UILabel alloc] init];
    bonusDetailLabel.text = @"1566元";
    [btnHistroy addSubview:bonusDetailLabel];
    bonusDetailLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(13)];
    
    
    CGFloat padding = MC_REALVALUE(10);
    [timerLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(btnHistroy.mas_left).offset(padding);
        make.centerY.equalTo(btnHistroy.mas_centerY);
    }];
    [timerDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(timerLabel.mas_right).offset(padding);
        make.centerY.equalTo(btnHistroy.mas_centerY);
    }];
    
    [bonusDetailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(btnHistroy.mas_right).offset(-padding);
        make.centerY.equalTo(btnHistroy.mas_centerY);
    }];
    
    [bonusLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(bonusDetailLabel.mas_left).offset(padding);
        make.centerY.equalTo(btnHistroy.mas_centerY);
    }];
}
- (void)setUpTopSelectedCardView{
    
    UIView *selectedCardView = [[UIView alloc] init];
    [self.view addSubview:selectedCardView];
    self.selectedCardView = selectedCardView;
    
    NSArray *selectedCardArray = @[@"万位",@"千位",@"百位",@"十位",@"个位"];
    for (NSInteger i = 0; i<selectedCardArray.count; i++) {
        UIButton *btn = [[UIButton alloc] init];
        [selectedCardView addSubview:btn];
        [btn setTitle:selectedCardArray[i] forState:UIControlStateNormal];
        btn.layer.borderColor = [UIColor darkGrayColor].CGColor;
        btn.layer.borderWidth = 1.0f;
        [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        btn.frame = CGRectMake(i*0.2 *G_SCREENWIDTH, 0, 0.2 *G_SCREENWIDTH, MC_REALVALUE(44));
        [btn addTarget:self action:@selector(selectedCardBtnClick:) forControlEvents:UIControlEventTouchUpInside];
        [btn setBackgroundImage:[UIImage createImageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
        [btn setBackgroundImage:[UIImage createImageWithColor:[UIColor redColor]] forState:UIControlStateSelected];
        btn.tag = 1999 - i;
   
        
    }
        [selectedCardView mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.btnHistroy);
            make.top.equalTo(self.btnHistroy.mas_bottom);
            make.height.equalTo(@(MC_REALVALUE(44)));
        }];
        selectedCardView.hidden = YES;

}

- (void)selectedCardBtnClick:(UIButton *)btn{
    btn.selected = !btn.selected;
    if (btn.selected == YES) {
         [self.selectedCardArray addObject:[btn titleForState:UIControlStateNormal]];
    } else {
         [self.selectedCardArray removeObject:[btn titleForState:UIControlStateNormal]];
    }
    self.baseWFmodel.selectedCardArray = self.selectedCardArray;
}
- (void)setUpBottomView{
    
    MCAlertView *alertView = [MCAlertView alertInstance];
    [self.view addSubview:alertView];
    self.alertView = alertView;
    
    UIView *bottomView = [[UIView alloc] init];
    bottomView.backgroundColor = [UIColor darkGrayColor];
    [self.view addSubview:bottomView];
    self.bottomView = bottomView;
    self.bottomView.frame = CGRectMake(0, G_SCREENHEIGHT- MC_REALVALUE(49), G_SCREENWIDTH, MC_REALVALUE(49));
    
    /*
     * 机选
     */
    MCPickBottomButton *randomBtn = [[MCPickBottomButton alloc] init];
    [bottomView addSubview:randomBtn];
    [randomBtn setTitle:@"机选" forState:UIControlStateNormal];
    [randomBtn setImage:[UIImage imageNamed:@"随机"] forState:UIControlStateNormal];
    [randomBtn setImage:[UIImage imageNamed:@"random_enabel"] forState:UIControlStateDisabled];
    self.randomBtn = randomBtn;
    randomBtn.backgroundColor=RGB(255, 255, 255);
    [randomBtn setTitleColor:RGB(83, 142, 202) forState:UIControlStateNormal];
    [randomBtn setTitleColor:RGB(140, 140, 140) forState:UIControlStateDisabled];

    randomBtn.tag = 1999;
    [randomBtn addTarget:self action:@selector(bottomViewBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    
    
    /*
     * 清空
     */
    MCPickBottomButton *delAllBtn = [[MCPickBottomButton alloc] init];
    [bottomView addSubview:delAllBtn];
    delAllBtn.tag = 1998;
    delAllBtn.backgroundColor=RGB(242, 242, 242);
    [delAllBtn setTitleColor:RGB(83, 142, 202) forState:UIControlStateNormal];
    [delAllBtn setTitle:@"清空" forState:UIControlStateNormal];
    [delAllBtn setImage:[UIImage imageNamed:@"清空"] forState:UIControlStateNormal];
    [delAllBtn addTarget:self action:@selector(bottomViewBtnClick:) forControlEvents:UIControlEventTouchUpInside];
   
    
    /*
     * 添加号码
     */
    MCPickBottomButton *addBtn = [[MCPickBottomButton alloc] init];
    addBtn.tag = 1997;
    self.addToShoppingCarBtn = addBtn;
    [bottomView addSubview:addBtn];
    addBtn.backgroundColor=RGB(83, 142, 202);
    [addBtn setTitle:@"添加号码" forState:UIControlStateNormal];
    [addBtn setImage:[UIImage imageNamed:@"添加"] forState:UIControlStateNormal];
    [addBtn addTarget:self action:@selector(bottomViewBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    UILabel *addItemCountLabel = [[UILabel alloc] init];
    addItemCountLabel.backgroundColor = [UIColor redColor];
    addItemCountLabel.layer.cornerRadius = MC_REALVALUE(10);
    addItemCountLabel.layer.masksToBounds = YES;
    addItemCountLabel.font = [UIFont systemFontOfSize:MC_REALVALUE(11)];
    addItemCountLabel.text = @"99+";
    addItemCountLabel.textAlignment = NSTextAlignmentCenter;
    addItemCountLabel.hidden = YES;
    addItemCountLabel.textColor = [UIColor whiteColor];
    
    self.addItemLabel = addItemCountLabel;
    
    /*
     * 去投注
     */
    MCPickBottomButton *gobyBtn = [[MCPickBottomButton alloc] init];
    gobyBtn.tag = 1996;
    gobyBtn.backgroundColor=RGB(37, 133, 207);
    
    [bottomView addSubview:gobyBtn];
    [gobyBtn setTitle:@"去投注" forState:UIControlStateNormal];
    [gobyBtn setImage:[UIImage imageNamed:@"箭头"] forState:UIControlStateNormal];
    [gobyBtn addTarget:self action:@selector(bottomViewBtnClick:) forControlEvents:UIControlEventTouchUpInside];
    [gobyBtn addSubview:addItemCountLabel];
  

    
    
    [randomBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(bottomView.mas_left);
        make.top.equalTo(bottomView.mas_top);
        make.bottom.equalTo(bottomView.mas_bottom);
        make.width.equalTo(@(G_SCREENWIDTH/4.0));
    }];
    [delAllBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(randomBtn.mas_right);
        make.top.equalTo(bottomView.mas_top);
        make.bottom.equalTo(bottomView.mas_bottom);
        make.width.equalTo(@(G_SCREENWIDTH/4.0));
    }];
    [addBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(delAllBtn.mas_right);
        make.top.equalTo(bottomView.mas_top);
        make.bottom.equalTo(bottomView.mas_bottom);
        make.width.equalTo(@(G_SCREENWIDTH/4.0));
    }];
    [gobyBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(addBtn.mas_right);
        make.top.equalTo(bottomView.mas_top);
        make.bottom.equalTo(bottomView.mas_bottom);
        make.width.equalTo(@(G_SCREENWIDTH/4.0));
    }];
    [addItemCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(gobyBtn.mas_right).offset(-MC_REALVALUE(5));
        make.top.equalTo(gobyBtn.mas_top).offset(MC_REALVALUE(5));
        make.height.equalTo(@(MC_REALVALUE(20)));
        make.width.equalTo(@(MC_REALVALUE(20)));
    }];
    }

#pragma mark - registerNotifacation
- (void)registerNotifacation{
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBorardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillHide:) name:UIKeyboardWillHideNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mcStackeUnitsGetBallWF:) name:@"MCSTAKEUNITS_GETBALL_WF" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideStackWindowss) name:@"MCSTAKEUNITS_HIDEN" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ballBtnClick) name:@"BALL_BTN_CLICK" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(action_YuanJiaoFen:) name:@"Action_YuanJiaoFen" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(action_Multiple:) name:@"Action_Multiple" object:nil];
    
}
- (void)hideStackWindowss{
    if (self.alertView.hidden == YES) {
        return;
    } else {
        [self.alertView hideStackWindow];
    }
    
}
- (void)ballBtnClick{
    self.randomBtnSelected = NO;
}

- (void)keyBorardWillShow:(NSNotification *)noti{
    NSDictionary *dic = noti.userInfo;
    CGRect rect = [dic[@"UIKeyboardBoundsUserInfoKey"] CGRectValue];
    self.alertView.frame = CGRectMake(0, G_SCREENHEIGHT- rect.size.height - MC_REALVALUE(49) - MC_REALVALUE(97), G_SCREENWIDTH, MC_REALVALUE(97));
    self.bottomView.frame = CGRectMake(0, G_SCREENHEIGHT- rect.size.height - MC_REALVALUE(49), G_SCREENWIDTH, MC_REALVALUE(49));
    
}

- (void)keyBoardWillHide:(NSNotification *)noti{
    
    self.alertView.frame = CGRectMake(0, G_SCREENHEIGHT - MC_REALVALUE(49) - MC_REALVALUE(97), G_SCREENWIDTH, MC_REALVALUE(97));
    self.bottomView.frame = CGRectMake(0, G_SCREENHEIGHT - MC_REALVALUE(49), G_SCREENWIDTH, MC_REALVALUE(49));
}
#pragma mark-修改了注数
- (void)mcStackeUnitsGetBallWF:(NSNotification *)noti{
    NSLog(@"%p",self);
    NSDictionary *dic = noti.userInfo;
    MCBallPropertyModel * model = dic[@"ballModel"];

    MCBallPropertyModel * model1 = dic[@"danshiModel"];
    if (model1 == nil) {
        if (model.stakeNumber >=1) {
            [self.alertView showStackWindow];
        } else if (model.stakeNumber ==0 && self.randomBtnSelected == NO) {
            [self.alertView hideStackWindow];
        }else{
        
        }

        
        self.baseWFmodel.stakeNumber=model.stakeNumber;
        [self relayOutAlertViewData];
        
    } else {
        [self.alertView showStackWindowWithHeight:146];

        self.baseWFmodel.stakeNumber=model1.stakeNumber;
        [self relayOutAlertViewData];
    }
   


}
#pragma mark-修改了元角分
- (void)action_YuanJiaoFen:(NSNotification *)noti{
    NSDictionary *dic = noti.userInfo;
    NSString * type= dic[@"type"];
    
    if ([type isEqualToString:@"元模式"]) {
        self.baseWFmodel.yuanJiaoFen=1;
    }else if ([type isEqualToString:@"角模式"]){
        self.baseWFmodel.yuanJiaoFen=0.1;
    }else if ([type isEqualToString:@"分模式"]){
        self.baseWFmodel.yuanJiaoFen=0.01;
    }else if ([type isEqualToString:@"厘模式"]){
        self.baseWFmodel.yuanJiaoFen=0.001;
    }
    [self relayOutAlertViewData];
    
}

#pragma mark-修改了倍数
- (void)action_Multiple:(NSNotification *)noti{
    NSDictionary *dic = noti.userInfo;
    NSString * multiple= dic[@"multiple"];
    self.baseWFmodel.multiple=[multiple intValue];
    [self relayOutAlertViewData];
}

#pragma mark-刷新弹框数据
-(void)relayOutAlertViewData{
    self.baseWFmodel.payMoney=self.baseWFmodel.stakeNumber*2*self.baseWFmodel.yuanJiaoFen*self.baseWFmodel.multiple;
    self.alertView.titleSelectedInfoLabel.text = [NSString stringWithFormat:@"已选%d注,共%.3f元",self.baseWFmodel.stakeNumber,self.baseWFmodel.payMoney];
    self.alertView.titleWinInfoLabel.text = [NSString stringWithFormat:@"若中奖，奖金%.3f元,可盈利%.3f元",self.baseWFmodel.bonus,self.baseWFmodel.yinli];
}

#pragma mark - timer
- (void)setUpTimer{
    self.dateString = @"00:00:03";
    self.lastString = @"距离024期截止:";
    __weak typeof(self) weakSelf = self;
    NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:weakSelf selector:@selector(setTImerLabelInfo) userInfo:nil repeats:YES];
    self.timer = timer;
    NSArray *strArray = [self.dateString componentsSeparatedByString:@":"];
    self.time = [strArray[0] intValue] * 3600 + [strArray[1] intValue]* 60 + [strArray[2] intValue];
    [[NSRunLoop mainRunLoop ] addTimer:timer forMode:NSRunLoopCommonModes];
}
- (void)setTImerLabelInfo{

    if (self.time == 0) {
        self.time = 600;
        
        NSRange range = [self.lastString rangeOfString:@"\\d+" options:NSRegularExpressionSearch];
        if (range.location != NSNotFound) {
            NSString *currentIssueStr = [self.lastString substringWithRange:range];
            int i = [currentIssueStr intValue];
            i --;
            self.timerLabel.text = [NSString stringWithFormat:@"距离%.3d期截止:",i];
        }
        
    }
    self.time --;
    NSString *hour = [NSString stringWithFormat:@"%.2d",self.time /3600];
    NSString *min = [NSString stringWithFormat:@"%.2d",(self.time - [hour intValue]*3600)/60];
    NSString *sec = [NSString stringWithFormat:@"%.2d",self.time%60];
    self.timerDetailLabel.text = [NSString stringWithFormat:@" %@:%@:%@ ",hour,min,sec];
    
    
    
}

- (void)stopTimer{
    
    [self.timer invalidate];
    
    self.timer = nil;
}

#pragma mark touch event
- (void)moreBtnClick:(UIButton *)btn{
    
    
}

/** 玩法*/
- (void)btnPCatergyClick:(UIButton *)btn{
    
    MCPullMenuViewController *VC = [[MCPullMenuViewController alloc]init];
    VC.delegate=self;
    /*
     * 传入彩种ID
     */
    VC.lotteriesTypeModel = self.lotteriesTypeModel;//山东11选5
    MCPullMenuPresentationController *PC = [[MCPullMenuPresentationController alloc] initWithPresentedViewController:VC presentingViewController:self];
    VC.transitioningDelegate = PC;
    [self presentViewController:VC animated:YES completion:NULL];
}
-(void)selectLotteryKindWithTag:(MCBasePWFModel*)baseWFmodel{
    

    self.baseWFmodel = baseWFmodel;
    self.baseWFmodel.yuanJiaoFen=1;
    self.baseWFmodel.bonus=0;
    self.baseWFmodel.multiple=1;
    self.baseWFmodel.payMoney=0;
    self.baseWFmodel.stakeNumber=0;
    self.baseWFmodel.yinli=0;
    [self.alertView.msBtn setTitle:@"元模式" forState:UIControlStateNormal];
    self.alertView.btTF.text=@"1";
    [self.alertView.moneyBtn setTitle:@"1982.0.0" forState:UIControlStateNormal];
    
    self.baseWFmodel.czID=self.lotteriesTypeModel.categoryID;
    self.baseWFmodel.czName=self.lotteriesTypeModel.name;
    self.lotteriesTypeModel.playOnlyNum=self.baseWFmodel.playOnlyNum;
    self.lotteriesTypeModel.typeId=self.baseWFmodel.typeId;
    if ([self.baseWFmodel.isShowSelectedCard isEqualToString:@"1"]) {
        self.selectedCardView.hidden = NO;
    } else {
        self.selectedCardView.hidden = YES;
    }
    [self.alertView hideStackWindow];
    
//    if ([self.baseWFmodel.filterCriteria  isEqualToString: @"2"]) {
//        self.bottomView.hidden = YES;
//        [self.alertView hideStackWindow];
//    } else {
//        self.bottomView.hidden = NO;
// 
//    }
    [self.selectedCardArray removeAllObjects];
    int i = 0;
    for (UIView *view in self.selectedCardView.subviews) {
        if ([view isKindOfClass:[UIButton class]]) {
            UIButton *btn = (UIButton *)view;
            if (i >= (5 - [baseWFmodel.SelectedCardNumber intValue])) {
                btn.selected = YES;
                [self.selectedCardArray addObject:[btn titleForState:UIControlStateNormal]];
                
            }
            i++;
            self.baseWFmodel.selectedCardArray = self.selectedCardArray;
        } else {
            
        }
    }
//    
//     [[MCMSPopView alertInstance] hideModelWindow];
//     [[MCMoneyPopView alertInstance] hideModelWindow];
    if ([baseWFmodel.isMachineSelectEnabled isEqualToString:@"0"]) {
        self.randomBtn.enabled = NO;
    } else {
        self.randomBtn.enabled = YES;
    }
    
   NSString *str = [NSString stringWithFormat:@"%@_%@",baseWFmodel.typeName,baseWFmodel.name];
   [self.btnPCatergy setTitle:str forState:UIControlStateNormal];
    if (baseWFmodel == nil) {
        return;
    }
    [[NSNotificationCenter defaultCenter] postNotificationName:@"CHANGE_LOTTERY_WF_ERJIWF" object:nil userInfo:@{@"baseModel":baseWFmodel}];

 
}

/** 历史*/
- (void)btnHistroyClick:(MCPickBottomButton *)btn{
    
}

- (void)bottomViewBtnClick:(MCPickBottomButton *)btn{
//    [[MCMSPopView alertInstance] hideModelWindow];
//    [[MCMoneyPopView alertInstance] hideModelWindow];
    if (btn.tag == 1999) {//机选
        [self randomBtnClick];
    }else if (btn.tag == 1998) {//清空
        [self clearAllButtonClick];
        [self.alertView hideStackWindow];
    }else if (btn.tag == 1997) {//添加号码
        [self addNumberToShoppingCar];
        [self clearAllButtonClick];
        [self.alertView hideStackWindow];
    }else if (btn.tag == 1996) {//去投注
        [self payTheSelectedNumbers];
        [self clearAllButtonClick];
        [self.alertView hideStackWindow];
    }
}


/**需要被覆盖的方法*/

#pragma mark - 需要被覆盖的方法
- (void)setUpUI{
    
}
- (void)randomBtnClick{
    self.randomBtnSelected = YES;
    
}

- (void)clearAllButtonClick{
    
}

- (void)addNumberToShoppingCar{

}

- (void)payTheSelectedNumbers{
    
}

#pragma mark - getter and setter 

- (NSMutableArray *)selectedCardArray{
    if (_selectedCardArray == nil) {
        _selectedCardArray = [NSMutableArray array];
    }
    return _selectedCardArray;
}
@end
